package com.sunxd.vue.application.facade.impl;

import com.sunxd.vue.application.facade.InteractiveActivityFacade;
import com.sunxd.vue.bean.Response;
import com.sunxd.vue.bean.request.InteractiveActivityQueryRequest;
import com.sunxd.vue.bean.request.InteractiveActivityRequest;
import com.sunxd.vue.bean.response.InteractiveActivityInfo;
import com.sunxd.vue.domain.service.InteractiveActivityService;
import com.sunxd.vue.infrastructure.adapter.db.base.Paging;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Component;

import static com.sunxd.vue.infrastructure.utils.ResponseHelper.or500;

/**
 * @author sun.xd
 * @description: description
 * @date 2024/4/25 12:13
 */
@Component
@RequiredArgsConstructor
public class InteractiveActivityFacadeImpl implements InteractiveActivityFacade {

    private final InteractiveActivityService interactiveActivityService;

    @Override
    public Response<Boolean> create(InteractiveActivityRequest request) {
        return or500(() -> interactiveActivityService.create(request));
    }

    @Override
    public Response<Boolean> update(InteractiveActivityRequest request) {
        return or500(() -> interactiveActivityService.update(request));
    }

    @Override
    public Response<InteractiveActivityInfo> detail(InteractiveActivityRequest request) {
        return or500(() -> interactiveActivityService.detail(request));
    }

    @Override
    public Response<Paging<InteractiveActivityInfo>> page(InteractiveActivityQueryRequest request) {
        return or500(() -> interactiveActivityService.page(request));
    }
}
